/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package radiostationv4;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author KiKiWi
 */
@Entity
@Table(name = "ALBUM")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Album.findAll", query = "SELECT a FROM Album a"),
    @NamedQuery(name = "Album.findByAlbumId", query = "SELECT a FROM Album a WHERE a.albumId = :albumId"),
    @NamedQuery(name = "Album.findByAlbumTitle", query = "SELECT a FROM Album a WHERE a.albumTitle = :albumTitle"),
    @NamedQuery(name = "Album.findByAlbumReleaseDate", query = "SELECT a FROM Album a WHERE a.albumReleaseDate = :albumReleaseDate"),
    @NamedQuery(name = "Album.findByAlbumType", query = "SELECT a FROM Album a WHERE a.albumType = :albumType"),
    @NamedQuery(name = "Album.findByAlbumDiskNumber", query = "SELECT a FROM Album a WHERE a.albumDiskNumber = :albumDiskNumber")})
public class Album implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ALBUM_ID")
    private Integer albumId;
    @Basic(optional = false)
    @Column(name = "ALBUM_TITLE")
    private String albumTitle;
    @Column(name = "ALBUM_RELEASE_DATE")
    @Temporal(TemporalType.DATE)
    private Date albumReleaseDate;
    @Column(name = "ALBUM_TYPE")
    private String albumType;
    @Basic(optional = false)
    @Column(name = "ALBUM_DISK_NUMBER")
    private int albumDiskNumber;
    @OneToMany(mappedBy = "albumId")
    private List<Song> songList;
    @JoinColumn(name = "ARTIST_ID", referencedColumnName = "ARTIST_ID")
    @ManyToOne
    private Artist artistId;
    @JoinColumn(name = "MUSIC_GROUP_ID", referencedColumnName = "MUSIC_GROUP_ID")
    @ManyToOne
    private MusicGroup musicGroupId;
    @JoinColumn(name = "MUSIC_PROD_COMPANY_ID", referencedColumnName = "MUSIC_PROD_COMPANY_ID")
    @ManyToOne(optional = false)
    private MusicProdCompany musicProdCompanyId;

    public Album() {
    }

    public Album(Integer albumId) {
        this.albumId = albumId;
    }

    public Album(Integer albumId, String albumTitle, int albumDiskNumber) {
        this.albumId = albumId;
        this.albumTitle = albumTitle;
        this.albumDiskNumber = albumDiskNumber;
    }

    public Integer getAlbumId() {
        return albumId;
    }

    public void setAlbumId(Integer albumId) {
        this.albumId = albumId;
    }

    public String getAlbumTitle() {
        return albumTitle;
    }

    public void setAlbumTitle(String albumTitle) {
        this.albumTitle = albumTitle;
    }

    public Date getAlbumReleaseDate() {
        return albumReleaseDate;
    }

    public void setAlbumReleaseDate(Date albumReleaseDate) {
        this.albumReleaseDate = albumReleaseDate;
    }

    public String getAlbumType() {
        return albumType;
    }

    public void setAlbumType(String albumType) {
        this.albumType = albumType;
    }

    public int getAlbumDiskNumber() {
        return albumDiskNumber;
    }

    public void setAlbumDiskNumber(int albumDiskNumber) {
        this.albumDiskNumber = albumDiskNumber;
    }

    @XmlTransient
    public List<Song> getSongList() {
        return songList;
    }

    public void setSongList(List<Song> songList) {
        this.songList = songList;
    }

    public Artist getArtistId() {
        return artistId;
    }

    public void setArtistId(Artist artistId) {
        this.artistId = artistId;
    }

    public MusicGroup getMusicGroupId() {
        return musicGroupId;
    }

    public void setMusicGroupId(MusicGroup musicGroupId) {
        this.musicGroupId = musicGroupId;
    }

    public MusicProdCompany getMusicProdCompanyId() {
        return musicProdCompanyId;
    }

    public void setMusicProdCompanyId(MusicProdCompany musicProdCompanyId) {
        this.musicProdCompanyId = musicProdCompanyId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (albumId != null ? albumId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Album)) {
            return false;
        }
        Album other = (Album) object;
        if ((this.albumId == null && other.albumId != null) || (this.albumId != null && !this.albumId.equals(other.albumId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "radiostationv4.Album[ albumId=" + albumId + " ]";
    }
    
}
